﻿using System;
using Ninject.Core;

namespace Example.Presentation.Kernel
{
    /// <summary>
    /// A dependency resolver implementation for Ninject
    /// </summary>
    public class NinjectDependencyResolver : IDependencyResolver
    {
        private static IKernel kernel = new StandardKernel();

        public T GetImplementationOf<T>()
        {
            var retval = kernel.Get<T>();
            kernel.Inject(retval);
            return retval;
        }

        public void Dispose()
        {
            kernel.Dispose();
        }

    }
}
